Repository navigation
[3.15] gh-159538: Fix deep chain leak in test_deeply_dotted_name (GH-159576) - #159609
Merged
Merged
Conversation
…onGH-159576) test_deeply_dotted_name() builds a 10,000-deep chain of lazy import placeholders in a thread with a 256 KiB C stack. Freeing the chain there defers most deallocations to the trashcan, which only drains them once the stack margin recovers. With a stack that small the margin never does, so the deferred objects were leaked when the thread exited, which -R reports as a reference leak on platforms with larger frames such as PPC64LE. Clear the namespace in a cleanup, which runs on the main thread. (cherry picked from commit c84d4b5) Co-authored-by: Brittany Reynoso <breynoso@meta.com>
miss-islington
requested review from
DinoV,
Yhg1s and
pablogsal
as code owners
October 17, 2026 01:45
vstinner
enabled auto-merge (squash)
October 17, 2026 01:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_deeply_dotted_name() builds a 10,000-deep chain of lazy import
placeholders in a thread with a 256 KiB C stack. Freeing the chain
there defers most deallocations to the trashcan, which only drains them
once the stack margin recovers. With a stack that small the margin
never does, so the deferred objects were leaked when the thread exited,
which -R reports as a reference leak on platforms with larger frames
such as PPC64LE.
Clear the namespace in a cleanup, which runs on the main thread.
(cherry picked from commit c84d4b5)
Co-authored-by: Brittany Reynoso breynoso@meta.com
test_lazy_import.test_deeply_dotted_name()leaks 19,650 references on PPC64LE CentOS9 #159538